/ Assembly List / LJCDBClientLib / DataManager / Update

Namespace - LJCDBClientLib


Parameters
dataObject - The record object.
keyColumns - The record containing the key field values.
propertyNames - The incuded column property names.
filters - The filter values.

Syntax

C#
public Void Update(Object dataObject, DbColumns keyColumns, List<String> propertyNames = null, DbFilters filters = null)

Updates the record. (DE)

Remarks

Parameters

keyColumns
This parameter defines the values to be used in the SQL where clause. It is only used if the 'filters' parameter is null.
The values are separated with the 'AND' operator.

propertyNames
This parameter defines the primary table columns that are to be updated. If it is null, then all the primary table columns are updated.
It must not include Calculated or Join columns or it will cause an error.

filters
This parameter defines the values to be used in the SQL where clause. If it is defined, then the keyColumns parameter is not used.
The 'filters' object can define a complex where clause including combinations of 'AND' and 'OR' operators.

Creates an "Update" DbRequest object, which is available in the Request property. The request object is passed to the ExecuteRequest() method.

Method Graph

All methods are in LJCDBMessage.DbCommon.

RequestDataColumns(dataObject)
RequestDataColumns(baseDefinition)
RequestColumns(dataObject)
CreateValueColumn(dbColumn)
RequestDataKeys(keyColumns)
RequestKeys(keyColumns)
CreateKeyColumn(keyColumn)

Example

C#
// This is an example of the Person Manager code that would access the
// DataManager Update() method. The supporting class code is listed at
// the DataManager class level.
    
using LJCNetCommon;
using LJCDBMessage;
    
/// <summary>Provides Person specific data manipulation methods.</summary>
public class PersonManager
{
  /// <summary>Updates a record in the database.</summary>
  /// <param name="dataObject">The data record.</param>
  /// <param name="keyObject">The record containing the key field values.</param>
  /// <param name="propertyNames">The incuded column property names.</param>
  /// <param name="filters">The filter values.</param>
  public void Update(Person dataObject, Person keyObject, List<string> propertyNames = null
    , DbFilters filters = null)
  {
    mDataManager.Update(dataObject, keyObject, propertyNames, filters);
    AffectedCount = mDataManager.AffectedCount;
    SQLStatement = mDataManager.SQLStatement;
  }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.